<?php

//echo br(3); ###########################################################################################

	$TEMP->set_file(array('handle' => DIR_VIEW_REGISTRAR . 'feesAmount.html'));
	
	$SLID 	= _GET('slid');
	
	$SLFID 	= _GET('slfid');
	
	$semesterLabel = $DSC->getSemesterLabel($SLID);
		$CID 	   = $semesterLabel['course_idFK'];
		$semDesc   = $semesterLabel['sem_desc'];
		$semCode   = $semesterLabel['sem_code'];
	
	$getFees = $DSC->getFees();
		
	if ( isset($_POST['subButton']) ) {
		
		$fee	= _POST('txtfee');
		$amount	= _POST('txtamount');
		
		if (empty($SLFID))
			$DSC->insertSemFeesLinker($SLID, $fee, $amount);
		else 
			$DSC->updateSemFeesLinker($SLID, $fee, $amount, $SLFID);
		
		redirect("?page=FeesAmount&slid=" . $SLID);
		exit();
	}
	
	if ( !empty($getFees) ) {
		$feesListSelect = '';
		foreach($getFees as $getFeesVal) {
			$feesListSelector = ($getFeesVal['fee_idPK'] == $SLFID) ? " selected='selected'" : '';		
			$feesListSelect  .= '<option class="checklist-course-option" value="' . $getFeesVal['fee_idPK'] . '" ' . $feesListSelector . '>' . $getFeesVal['fee_desc'] . '</option>';
		}
	}
	
	$TEMP->set_var(array('reg_sub_menu'		=> $pageLib->registrarSubMenu(DIR_IMAGES),
						 'semester_label' 	=> $semDesc . ' (' . $semCode . ')',
						 
						 
						 'fees_list'		=> $feesListSelect,
						 'dept_course'		=> $strAccCourse,
						 'txtfee'			=> $txtfee,
						 'txtamount'		=> $txtamount,
						 'course_id'		=> $CID,
						 'sem_fee_linker_id'=> $SLFID,
						 'sem_linker_id'	=> $SLID
						));
?>